from tools_algorithm import *


class Solution:
    def maxNumOfMarkedIndices(self, nums: List[int]) -> int:
        n = len(nums)
        nums.sort()
        i, j = 0, n // 2
        ans = 0
        while i < n // 2 and j < n:
            if nums[i] * 2 <= nums[j]:
                ans += 2
                i += 1
            j += 1
        return ans
